home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4650 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.4 KB

  1. Path: canopus.cc.umanitoba.ca!natewild
  2. From: natewild@mbnet.mb.ca (Nathan T. Wild)
  3. Newsgroups: comp.os.msdos.programmer,comp.lang.c
  4. Subject: Pointer Stew...
  5. Date: Mon, 05 Feb 1996 22:33:00 -0500
  6. Organization: WankerNET - Digital TimeWasters Inc.
  7. Message-ID: <svsFxc9nXUNB083yn@mbnet.mb.ca>
  8. NNTP-Posting-Host: access.mbnet.mb.ca
  9. Originator: natewild@access.mbnet.mb.ca
  10.  
  11. I am implimenting a system, but which executable code modules are loaded
  12. from disk files into allocated blocks.
  13.  
  14. This is working very well.  I allocated a big enough block, load the
  15. "driver" in and aim a function pointer ar it.  
  16.  
  17. What I would like to do is have the code that I load in contain near
  18. pointers to it's own groups of functions.  I have placed a header on the
  19. driver module I wish to load that contains the offset from the current
  20. segment for two functions contained within the driver block.
  21.  
  22. This time I want to calculate the segment and read in the offset and set
  23. both function pointers accordingly.
  24.  
  25. I am having difficulty dereferencing things???
  26.  
  27.  
  28.  
  29. Say, for example that my code block is allocated at XXXX:0004.  The first 2
  30. bytes are the pointer (within the block) to the first function and the next
  31. 2 bytes are the pointer to the second function.
  32.  
  33. I want to set my function pointer to the segment XXXX and the offset stored
  34. at XXXX:0004 & 0005.  No matter how I reference this, I get my function
  35. pointing to XXXX:0004!
  36.  
  37.  
  38. I have tried (where driverPtr == XXXX:0004 and is a void far *):
  39.     func1ptr = (void far **)driverPtr
  40.     func2ptr = (void far **)(driverPtr+2)
  41.     
  42. But I get XXXX:0004 every time?  I can set the function pointers to what I
  43. want if I use MK_FP(), FP_SEG() and peek(), but there has got to be a
  44. better way than this?
  45.  
  46.  
  47.  
  48.  
  49. In short, how, given the address of a stored pointer, set a function to
  50. point to the address stored, no to the location it is stored in???
  51.  
  52. This is driving me nuts as I am sure it is fairly simple...
  53.  
  54. Please respond via Email, I cannot access this group "live"...
  55.  
  56. Thanks in advance...
  57.  
  58. |--------------------------------------------------------------------|
  59. | ooooO (``)   (``) Ooooo | Nathan T. Wild                           | 
  60. | (   ) )  (   )  ( (   ) | natewild@mbnet.mb.ca                     |
  61. | )  (  (   ) (   ) )  (  | ftp://ftp.mbnet.mb.ca/pub/natewild       |
  62. | (__)  ooooO Ooooo (__)  | http://www.mbnet.mb.ca/~natewild         |
  63. |--------------------------------------------------------------------|
  64.